package com.nanshenycd.dao;

import com.nanshenycd.pojo.Blog;
import com.nanshenycd.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface BlogDao {

    int saveBlog(Blog blog);

    List<Blog> listBlog();

    Blog getBlogById(Long id);

    int saveBlogAndTag(BlogAndTag blogAndTag);

    int deleteBlogAndTag(Long blogId);

    List<BlogQuery> getAllBlogByBlogQuery();

    List<BlogQuery> getBlogByTitleAndTypeAndRecommend(SearchBlog searchBlog);

    int deleteBlog(Long id);

    int updateBlog(ShowBlog blog);

    //获取最新推荐
    List<RecommendBlog> getAllRecommendBlog();

    //首页搜索
    List<FirstPageBlog> getSearchBlog(String query);

    List<FirstPageBlog> getAllFirstPageBlog();

    //博客详情
    DetailedBlog getDetailedBlog(Long id);

    List<FirstPageBlog> getByTypeId(Long typeId);

    List<FirstPageBlog> getByTagId(Long tagId);

    //根据年份获取年份字符串集合
    List<String> findGroupYear();

    //按年份查询博客信息
    List<Blog> findByYear(String year);

    int updateViews(Long id);
}
